package net.oschina.git.zengzhihao.two;

import java.text.NumberFormat;

/**
 * 定义JCB数据块
 * 
 * @author zengzhihao
 */
public class JCB {

	/**
	 * 作业名称
	 */
	private String name;
	/**
	 * 到达时间
	 */
	private Integer arrivalTime;
	/**
	 * 服务时间
	 */
	private Integer serviceTime;
	/**
	 * 开始时间
	 */
	private int beginTime;
	/**
	 * 优先数
	 */
	private Integer priority;

	/**
	 * 状态
	 */
	private String status;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getArrivalTime() {
		return arrivalTime;
	}

	public void setArrivalTime(Integer arrivalTime) {
		this.arrivalTime = arrivalTime;
	}

	public Integer getServiceTime() {
		return serviceTime;
	}

	public void setServiceTime(Integer serviceTime) {
		this.serviceTime = serviceTime;
	}

	public int getBeginTime() {
		return beginTime;
	}

	public void setBeginTime(int beginTime) {
		this.beginTime = beginTime;
	}

	/**
	 * 完成时间
	 */
	public Integer getFinishTime() {
		return this.beginTime + this.serviceTime;
	}

	/**
	 * 周转时间
	 */
	public int getCircleTime() {
		return getFinishTime() - this.arrivalTime;
	}

	/**
	 * 带权周转时间
	 */
	public String getAvgCircleTime() {
		NumberFormat format = NumberFormat.getNumberInstance();
		format.setMaximumFractionDigits(2);
		return format.format(getCircleTime() / (this.serviceTime + 0.0));
	}

	public Integer getPriority() {
		return priority;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

}
